package com.cljh.mapper;

import com.cljh.bean.Admin;
import com.cljh.bean.Product;
import com.cljh.controller.page.ProductPageBean;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface AdminMapper {


//    @Insert("insert into mtmall_test.admin (username, password) values (#{admin.username},#{admin.password});")
    int save(@Param("admin") Admin admin);

    @Select("select * from mtmall_test.admin where username=#{admin.username} ;")
    Admin selectByUsername(@Param("admin") Admin admin);

    @Select("select * from mtmall_test.admin where username =#{admin.username} and password = #{admin.password};")
    Admin select(@Param("admin") Admin admin);

    @Delete("delete from mtmall_test.admin where id=#{id};")
    int deleteId(Integer id);

    int deleteIds(@Param("ids") List<Integer> ids);

    int upd(@Param("admin")Admin admin);

    @Select("select * from mtmall_test.admin where id=#{id} ;")
    Admin getById(Integer id);

    List<Admin> selectAllByCondition(@Param("begin")Integer begin, @Param("size") Integer size, @Param("admin") Admin admin);

    int selectCount(@Param("admin")Admin admin);

    @Select("select * from mtmall_test.admin where id=#{id} ;")
    Admin selectById(@Param("id")Integer id);

    @Select("select * from mtmall_test.admin;")
    List<Admin> selectAll();

    int saveAll( @Param("admins") List<Admin> admins);

    Admin selectByEmail(@Param("username") String username, @Param("emailCode") String emailCode);

    Admin selectByEmailCode(@Param("email") String email);
}
